package com.actionsky.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.actionsky.dao.NewsActiveDAO;
import com.actionsky.entity.NewsActive;

public class NewsActiveAction extends HttpServlet {
	
	private static final long serialVersionUID = 1L;
	List<NewsActive> newsList = null;
	List<NewsActive> activeList = null;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		//新闻动态界面数据查询，按类型1，新闻 2，行业
		newsList = NewsActiveDAO.findNewsActiveByType(1, 0, 10);
		activeList = NewsActiveDAO.findNewsActiveByType(2, 0, 10);
		request.getSession().setAttribute("newsList",newsList);
		request.getSession().setAttribute("activeList",activeList);
		response.sendRedirect("index.jsp");
	}

	public void init() throws ServletException {
	}
	public void destroy() {
		super.destroy(); 
	}
}
